import { api } from "../api"

export function fetchTeacherIdApi() {
  try {
    return api.get('/java/user/whoami_frontend');
  }
  catch (error) {
    throw new Error('获取章教师id失败')
  }
}

export function fetchDataApi(teacherId: string, courseId: string | null, chapterId: string | null, fileId: string | null, time: number, type: string) {
  try {
    return api.get('/java/teacher/screen/refresh', {
      params: {
        teacherId,
        courseId,
        chapterId,
        fileId,
        time,
        type,
      },
    });
  }
  catch (error) {
    throw new Error("获取折线图数据失败")
  }
}

export function fetchSchoolDataApi(teacherId: string) {
  try {
    return api.get(`/java/teacher/screen`, {
      params: {
        teacherId,
      },
    });
  }
  catch (error) {
    throw new Error("获取学校数据失败")
  }
}
